Skip to content

watch: add file watching with automatic process restart#4

Merged
croaky merged 4 commits intomainfrom
croaky/reload
Feb 4, 2026
Merged

watch: add file watching with automatic process restart#4
croaky merged 4 commits intomainfrom
croaky/reload

Conversation

@croaky
Copy link
Owner

@croaky croaky commented Feb 4, 2026

Add watching to procman where it benefits projects of all languages
rather than build it into Ruby or Go projects/frameworks.

Syntax: add # watch: PATTERNS to Procfile.dev entries:

web: bundle exec ruby cmd/web.rb  # watch: lib/**/*.rb

On file change matching a pattern, procman sends SIGINT to the process,
waits for exit, and restarts. Changes are debounced (500ms) to avoid
rapid restarts during multi-file saves.

Processes without a watch annotation behave exactly as before.

Co-Authored-By: Warp agent@warp.dev

croaky and others added 2 commits February 4, 2026 11:29
Add watching to procman where it benefits projects of all languages
rather than build it into Ruby or Go projects/frameworks.

Syntax: add `# watch: PATTERNS` to Procfile.dev entries:

    web: bundle exec ruby cmd/web.rb  # watch: lib/**/*.rb

On file change matching a pattern, procman sends SIGINT to the process,
waits for exit, and restarts. Changes are debounced (500ms) to avoid
rapid restarts during multi-file saves.

Processes without a watch annotation behave exactly as before.

Co-Authored-By: Warp <agent@warp.dev>
- Fix data race in running(): use mutex-protected started/stopped flags
  instead of reading exec.Cmd internals (ProcessState) without sync
- Fix hanging goroutines on shutdown: use time.AfterFunc instead of
  goroutine waiting on timer channel that could block forever if drained
- Consolidate to single shared fsnotify watcher at manager level
- Improve test cleanup to avoid orphaned processes

Co-Authored-By: Warp <agent@warp.dev>
@croaky croaky changed the title croaky/reload watch: add file watching with automatic process restart Feb 4, 2026
Copy link

@brittballard brittballard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@croaky croaky merged commit 39a3002 into main Feb 4, 2026
1 check passed
@croaky croaky deleted the croaky/reload branch February 4, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants